#include <stdio.h>
#include <errno.h>
#include "symvers.h"

int main(int argc, char **argv)
{
    int ret;
    const struct symvers_info * symvers;

    if (argc < 2)
    {
        printf("%s <path>\n", argv[0]);
        return EINVAL;
    }
    ret = symvers_init(argv[1]);
    if(0 != ret)
    {
        printf("symvers_init failed!ret=%d\n", ret);
        return ret;
    }
    symvers = symvers_get_verinfo_list();
    printf("EXPORT_SYMBOL : \n");
    for(unsigned int i = 0; i < symvers->sym_count; i++)
    {
        printf("    0x%08lx    %s\n", symvers->list[i].crc, symvers->list[i].name);
    }
    printf("EXPORT_SYMBOL_GPL : \n");
    for(unsigned int i = 0; i < symvers->symgpl_count; i++)
    {
        printf("    0x%08lx    %s\n", symvers->list[i + symvers->sym_count].crc, symvers->list[i + symvers->sym_count].name);
    }
    symvers_uninit();
    return 0;
}
